/**
 * do all the "wiring" needed tp run the app
 * @author maulin
 */
dojo.provide("medryx.context");
dojo.require("medryx.model.Team");
dojo.require("medryx.model.TeamPager");
dojo.require("medryx.model.Pager");
dojo.require("medryx.model.Patient");
dojo.require("medryx.model.Visit");
dojo.require("medryx.model.Provider");
dojo.require("medryx.orm.EntityManagerStore");
dojo.require("medryx.orm.XhrPersistenceService");
dojo.require("medryx.config");

(function() {
	medryx.context ={};
	var ctx = medryx.context;
	var ps = new medryx.orm.XhrPersistenceService(medryx.config.persistenceService);
	var em = new medryx.orm.EntityManagerStore(ps)
	
	//register persistent entities
	em.registerClass({
		entityClassName: "medryx.model.Team",
		alias: "Team"
	});
    em.registerClass({
        entityClassName: "medryx.model.TeamPager",
        alias: "TeamPager"
    });
    em.registerClass({
        entityClassName: "medryx.model.Pager",
        alias: "Pager"
    });
	em.registerClass({
        entityClassName: "medryx.model.Provider",
        alias: "Provider"
    });
	em.registerClass({
        entityClassName: "medryx.model.Patient",
        alias: "Patient"
    });
	em.registerClass({
        entityClassName: "medryx.model.Visit",
        alias: "Visit"
    });

	ctx.entityManager = em;
	ctx.persistenceService = ps;
	
})();

